1. Field of the Invention
The present invention relates to a method for controlling a memory card and a method for controlling a nonvolatile semiconductor memory, and in particular, to a method for controlling a nonvolatile semiconductor memory having a predetermined erase block size.
2. Description of the Related Art
Memory cards using a nonvolatile memory such as a flash memory are now used as recording media for music or video data. A FAT system is used as a file system for the memory card. Jpn. Pat. Appln. KOKAI Publication No. 7-141479 discloses an example in which the FAT system is adopted as a file system for a flash memory. The FAT file system is originally used for a medium such as a hard disk on which high-speed, random rewrite operations can be performed. The random write operation is a method of random writing data in free sectors regardless of their addresses (the sectors are write area units that the file system recognizes).
A typical example of a flash memory used for a memory card is a NAND type flash memory. Data in the NAND type flash memory can be erased only in block units. One block contains pages that are write units. Thus, to rewrite only a part of the data stored in a block, it is necessary to write a new write data to a new erased block and to copy data, which are not to be rewritten, from the old block containing the old data (that are to be changed to new data) to the new block. This process is called “move accompanying write (involved data copy)”. The move accompanying write involves an operation of copying data that is not to be rewritten. Consequently, frequent move accompanying write operations drastically increase overhead.
With a FAT file system, every operation of rewriting cluster data in a file requires FAT data to be rewritten. Thus, if the FAT file system is adopted as a file system to manage a NAND type flash memory, every operation of rewriting cluster data results in a move accompanying write. This reduces file rewrite speed.